#ifndef __EEPROM_H
#define __EEPROM_H

// 参数存放地址
#define ADDR_BASE        0x00
#define ADDR_OFFSET_H    (ADDR_BASE + 0)
#define ADDR_OFFSET_L    (ADDR_BASE + 1)
#define ADDR_PID_H       (ADDR_BASE + 2)
#define ADDR_PID_L       (ADDR_BASE + 3)
#define ADDR_SET_H       (ADDR_BASE + 4)
#define ADDR_SET_L       (ADDR_BASE + 5)
#define ADDR_ALERT_VALUE (ADDR_BASE + 6)
#define ADDR_PWM_VALUE   (ADDR_BASE + 7)
#define ADDR_OHM_VALUE   (ADDR_BASE + 8)
#define ADDR_LOCK_VALUE  (ADDR_BASE + 9)

// 正负
#define POSITIVE           0xA1
#define NEGETIVE           0xA0

// 默认值
#define OFFSET_DEFAULT   0
#define PID_DEFAULT      100
#define SET_DEFAULT      400
#define ALERT_DEFAULT    20      
#define LOCK_DEFAULT     10   

#define PWM_DEFAULT      30       // %
#define OHM_DEFAULT      47       // 0.1k

#define OHM_4K7_OFFSET   -66

// EEPROM
extern void eeprom_init(void);
extern void eeprom_write(uint8_t addr, uint8_t  dat);
extern uint8_t eeprom_read(uint8_t addr);
extern void load_default_parameter(void);
extern void read_parameter(void);
extern void save_parameter(void);
extern void save_set_temp(void);

#endif
